package com.stlm2.controller;

import com.stlm2.dems.service.GoodsCategoryService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;

/**
 * Created by apple on 2017/10/12.
 */
@Controller
@RequestMapping("/goodsCategoryC")
public class GoodsCategoryController {

    @Resource
    private GoodsCategoryService goodsCategoryService;



    @ResponseBody
    @RequestMapping(value="/showGoodsCategory.json",produces="application/json;charset=UTF-8")
    public String displayGoodsCategory(String companyCode){
        return goodsCategoryService.disPlayCategory();
    }


    @ResponseBody
    @RequestMapping(value="/oneLevelCategory.json",produces="application/json;charset=UTF-8")
    public String oneLevelGoodsCategory(String companyCode){
        return goodsCategoryService.getOneLevelCategory();
    }


    @ResponseBody
    @RequestMapping(value="/twoLevelCategory.json",produces="application/json;charset=UTF-8")
    public String getByOneLevelGoodsCategory(String companyCode,String parentCategoryId){
        return goodsCategoryService.getByOneLevelCategory(parentCategoryId);
    }

    @ResponseBody
    @RequestMapping(value="/threeLevelCategory.json",produces="application/json;charset=UTF-8")
    public String getByTwoLevelGoodsCategory(String companyCode,String parentCategoryId){
        return goodsCategoryService.getByTwoLevelCategory(parentCategoryId);
    }

    @ResponseBody
    @RequestMapping(value="/type2.json",produces="application/json;charset=UTF-8")
    public String getByTypeAndLevel(String companyCode){
        return goodsCategoryService.getByTypeAndLevel();
    }
}
